package fischl.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;

public final class VideoModel {
  /**
   * 视频标题
   */
  public String title;
  /**
   * 视频id
   */
  public String vid;
  /**
   * 作者id
   */
  public String cover;
  /**
   * 作者id
   */
  public String upId;// douyu下是upid，虎牙下是弹幕聊天id
  /**
   * 作者id
   */
  public String upName;
  /**
   * 视频场次 (13点场)
   */
  public String dateStr;
  /**
   * 直播间地址
   */
  public String liveRoom;
  /**
   * 视频播放地址
   */
  public String videoUrl;
  /**
   * 视频发布时间
   * 没有使用，稍后将删除
   */
  public String publishTime;//epoch millis
  /**
   * 分p数量
   */
  public int sliceCount;
  /**
   * 是否已处理标记
   */
  public boolean isProcessed;

  public Date date;

  @Override
  public boolean equals(Object o) {
    return o instanceof VideoModel && Objects.equals(upId, ((VideoModel) o).upId)
      && Objects.equals(vid, ((VideoModel) o).vid);
  }

  @Override
  public int hashCode() {
    int result = vid.hashCode();
    result = 31 * result + upId.hashCode();
    return result;
  }

  public static List<VideoModel> testData() {
    VideoModel model = new VideoModel();
    model.title = "微笑【2021-10-28 13点场】";
    model.vid = "DrwnvzPOxqjMPNaX";
    model.cover = "https://sta-op.douyucdn.cn/vod-cover/2021/10/28/4b54be1372312a4df78879eee1fdc9fc.png";
    model.upName = "微笑";
    model.upId = "a1nAzVNV5AXJ";
    model.dateStr = "10-28";
    model.liveRoom = "https://www.douyu.com/16101";
    model.videoUrl = "https://v.douyu.com/show/DrwnvzPOxqjMPNaX";
    model.publishTime = "2021-10-28 16:00:01";
    model.sliceCount = 4;
    model.isProcessed = false;
    List<VideoModel> result = new ArrayList<>();
    result.add(model);
    result.add(model);
    result.add(model);
    result.add(model);
    return result;
  }
}